<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/jquery-1.11.3.js"></script>
<script src="js/bootstrap.min.js"></script>
<link href="css/base.css" rel="stylesheet" />
<link href="css/handonorder.css" rel="stylesheet" />
</head>
<body>
	<script>
		
		function getTotalPrice(){
			var totalPrice=0;
		    totalPrice+=parseInt($(".sendway:checked").val());
		    totalPrice+=parseInt($(".payway:checked").val());
		    totalPrice+=parseInt($(".pack:checked").val());
		    totalPrice+=parseInt(${totalPrice});
		    $("#totalPriceShow").text(totalPrice);
		    $(".totalPriceValue").val(totalPrice);
		}
		$(function(){
			getTotalPrice();
			$(".sendway").click(function(){
				getTotalPrice();
			})
			$(".payway").click(function(){
				getTotalPrice();
			})
			$(".pack").click(function(){
				getTotalPrice();
			})
			$(".address li:eq(0)").children(".addressChoice").prop("checked",true);
		})
</script>
	<div class="both">
		<div class="header">
			<div class="container">
				<div class="nav">
					<p>
						<c:if test="${LoginUser==null}">
							<a href="login.html">登陆</a>&nbsp;&nbsp;
                    </c:if>
						<c:if test="${LoginUser!=null}">
							<a>${LoginUser.userName},欢迎你！</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                    <a href="cart.html">我的购物车</a>&nbsp;&nbsp;|&nbsp;&nbsp;
                    <a href="login.html?out=t">注销</a>&nbsp;&nbsp;
                    </c:if>
						|&nbsp;&nbsp; <a href="register.html">注册</a>
					</p>
					<p>|&nbsp;符合人类进步的食品</p>
					<p>
						<a href="index.html">首页</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a
							href="productList.html">蛋糕名录</a>&nbsp;&nbsp;|&nbsp;&nbsp; <a
							href="user.html">用户中心</a>
					</p>
				</div>
			</div>
		</div>
		<div class="main">
			<div class="container">
				<p>
					<img src="image/hengfu.jpg"
						style="height: 120px; margin-top: 20px;" alt="" />
				</p>
				<h3>填写和提交订单信息</h3>
				<hr />
				<div class="editForm">
					<form action="handonorder.html" method="post">
						<div class="editForm_content" id="addressInfo">
							<p class="formtitle">收货人信息</p>
							<div class="content">
								<ul class="address">
									<c:forEach items="${addresses}" var="a">
										<li><input type="radio" value="${a.id}"
											class="addressChoice" name="addressid"/>
											<ul class="UserInfo">
												<li style="margin-left: -15px;">收货人姓名:${a.consignee}</li>
												<li>收货地址:${a.address}</li>
												<li>手机号:${a.phone}</li>
											</ul></li>
									</c:forEach>
								</ul>
							</div>
						</div>
						<hr />
						<div class="editForm_content">
							<p class="formtitle">配送方式</p>
							<div class="content">
								<input type="radio" name="sendway" class="sendway" id="shentong" value="15" checked/><label for="shentong">申通快递(费用:¥ 15.00元)</label>
								<input type="radio" name="sendway" class="sendway" id="youji" value="13.5"/><label for="youji">邮局平邮(费用:¥13.50元)</label> 
								<input type="radio" name="sendway" class="sendway" id="daofu" value="0"/><label for="daofu">运费到付(费用:¥ 0.00元)</label>
							</div>
						</div>
						<hr />
						<div class="editForm_content">
							<p class="formtitle">支付方式</p>
							<div class="content">
								<input type="radio" name="payway" class="payway" id="yinlian" value="10" checked/><label for="yinlian">银联转账(费用:¥ 10.00元)</label> 
								<input type="radio"name="payway" class="payway" id="wx" value="3"/><label for="wx">微信支付(费用:¥3.00元)</label> 
								<input type="radio" name="payway" class="payway" id="huodaofukuan" value="0"/><label for="huodaofukuan">货到付款(费用:¥ 0.00元)</label>
							</div>
						</div>
						<hr />
						<div class="editForm_content">
							<p class="formtitle">商品包装</p>
							<div class="content">
								<input type="radio" name="pack" class="pack" id="noPacking" value="0" checked/><label for="noPacking">不包装(费用:¥ 0.00元)</label> 
								<input type="radio" name="pack" class="pack" id="Packing" value="10"/><label for="Packing">精品包装(费用:¥10.00元)</label>
							</div>
						</div>
						<hr />
						<p class="formtitle">商品列表</p>
						<div class="container-fluid">
							<div class="row-fluid">
								<div class="span12">
									<table id="cakeproductlist"
										class="table table-bordered table-hover">
										<thead>
											<tr>
												<th>编号</th>
												<th>商品名称</th>
												<th>属性</th>
												<th>本店价</th>
												<th>购买数量</th>
												<th>小计</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach var="c" items="${cakes}" varStatus="s">
												<tr>
													<td>${s.index+1}<img src="image/productImg/${c.mainimg}" alt="" />
														<input type="hidden" name="cid" value="${c.id}" /></td>
													<td>${c.name}</td>
													<td>磅:${c.count}.0磅</td>
													<td>¥${c.price}元</td>
													<td>${c.count}<input type="hidden" name="count"
														value="${c.count}" /></td>
													<td>¥${c.price*c.count}元<input type="hidden"
														name="unitprice" value="${c.price*c.count}" /></td>
												</tr>
											</c:forEach>
										</tbody>
									</table>
								</div>
							</div>
						</div>
						<div class="totalPrice">
							<p>
								总计:¥<span style="font-size: 20px" id="totalPriceShow"></span>元<input
									type="hidden" name="totalPrice" class="totalPriceValue"
									value=""/>
							</p>
						</div>
						<button class="hanonlist">提交订单</button>
					</form>
				</div>
			</div>
		</div>
		<div class="footer">
			<hr>
			<div class="container">
				<div>
					<p>©2005-2014&nbsp;21Cake官网版权所有，并保留所有权利</p>
					<ul>
						<li><a href="#">联系我们</a> &nbsp;</li>
						<li><a href="#">售后流程</a> &nbsp;</li>
						<li><a href="#">订购方式</a> &nbsp;</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
</body>
</html>